package com.netease.p.a;

import java.io.FilterOutputStream;
import java.io.OutputStream;

public class b extends FilterOutputStream
{
  private final boolean a;
  private final a b;
  private final byte[] c = new byte[1];

  public b(OutputStream paramOutputStream)
  {
    this(paramOutputStream, true);
  }

  public b(OutputStream paramOutputStream, boolean paramBoolean)
  {
    super(paramOutputStream);
    this.a = paramBoolean;
    this.b = new a();
  }

  public b(OutputStream paramOutputStream, boolean paramBoolean, int paramInt, byte[] paramArrayOfByte)
  {
    super(paramOutputStream);
    this.a = paramBoolean;
    this.b = new a(paramInt, paramArrayOfByte);
  }

  private void a(boolean paramBoolean)
  {
    int i = this.b.b();
    if (i > 0)
    {
      byte[] arrayOfByte = new byte[i];
      int j = this.b.a(arrayOfByte, 0, i);
      if (j > 0)
        this.out.write(arrayOfByte, 0, j);
    }
    if (paramBoolean)
      this.out.flush();
  }

  public void close()
  {
    if (this.a)
      this.b.c(this.c, 0, -1);
    while (true)
    {
      flush();
      return;
      this.b.d(this.c, 0, -1);
    }
  }

  public void flush()
  {
    a(true);
  }

  public void write(int paramInt)
  {
    this.c[0] = (byte)paramInt;
    write(this.c, 0, 1);
  }

  public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    if (paramArrayOfByte == null)
      throw new NullPointerException();
    if ((paramInt1 < 0) || (paramInt2 < 0) || (paramInt1 + paramInt2 < 0))
      throw new IndexOutOfBoundsException();
    if ((paramInt1 > paramArrayOfByte.length) || (paramInt1 + paramInt2 > paramArrayOfByte.length))
      throw new IndexOutOfBoundsException();
    if (paramInt2 > 0)
    {
      if (!this.a)
        break label83;
      this.b.c(paramArrayOfByte, paramInt1, paramInt2);
    }
    while (true)
    {
      a(false);
      return;
      label83: this.b.d(paramArrayOfByte, paramInt1, paramInt2);
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.p.a.b
 * JD-Core Version:    0.6.0
 */